<?PHP
if (!session_start()) { session_start(); };
/*if (!isset($_SESSION['lgnapproved'])) {
	die(header('Location: login.php'));
}*/

include("functions.php");
include("cnnxn.php");
connect();

if (isset($_POST['submit'])) {

$fieldnames="";
$fieldvalues="";
while (list($key,$value) = each($_POST)) {
	$fieldnames=$fieldnames.$key.',';
	if (ctype_digit($value)) {
       $fieldvalues=$fieldvalues.$value.',';
   } else {
       $fieldvalues=$fieldvalues.'"'.addslashes($value).'",';
   }
}
$fieldnames=substr_replace($fieldnames,"",-8);
$fieldvalues=substr_replace($fieldvalues,"",-10);
$SQLadd='INSERT INTO av_eventplayers ('.$fieldnames.') VALUES ('.$fieldvalues.');';
//print $SQLadd;
$sendit_add=mysqli_query($db,$SQLadd) or die(mysqli_error($db));
die(header("Location: av_eventplayers_viewall.php"));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>daleclark.net</title>
<link type="text/css" rel="stylesheet" href="adminstyles.css" />
</head>
<body>
<div id="adminwrapper">
<div id="adminlogo"></div>
<?PHP navigation(); ?>
<div id="admincontent">
<h3>Add Record to av_eventplayers</h3><form name="addForm" method="POST" action="av_eventplayers_add.php">
<p><span class="label">player01</span><span class="inputbox"><input name="player01" type="text" /></span></p>
<p><span class="label">player02</span><span class="inputbox"><input name="player02" type="text" /></span></p>
<p><span class="label">player03</span><span class="inputbox"><input name="player03" type="text" /></span></p>
<p><span class="label">player04</span><span class="inputbox"><input name="player04" type="text" /></span></p>
<p><span class="label">eventid</span><span class="inputbox"><input name="eventid" type="text" /></span></p>
<p><span class="label">divisionid</span><span class="inputbox"><input name="divisionid" type="text" /></span></p>
<p><span class="label">finishposition</span><span class="inputbox"><input name="finishposition" type="text" /></span></p>
<input type="submit" value="submit" name="submit" /></form>
</div>
</div>
</body>
</html>